import { createApp,nextTick } from 'vue'
import mobileMessage from '@/views/mobile/message.vue'
const mobileMessageBox = mobileMessage
mobileMessage.install = function (data) {
  let instance = createApp(mobileMessageBox, { data })
  const dFrag = document.createDocumentFragment()
  // 将组件挂载在文档碎片上
  const vm = instance.mount(dFrag)
  document.body.appendChild(dFrag)
  nextTick(() => {
    vm.init()
  })
}
mobileMessage.closeAll = function () {
  let domArr = document.querySelectorAll('.mobile-message-box')
  domArr.forEach((item) => {
    document.body.removeChild(item)
  })
}
import mobileConfirm from '@/views/mobile/confirm.vue'
const mobileConfirmBox = mobileConfirm
mobileConfirm.install = function (data) {
  let instance = createApp(mobileConfirmBox, { data })
  const dFrag = document.createDocumentFragment()
  // 将组件挂载在文档碎片上
  const vm = instance.mount(dFrag)
  document.body.appendChild(dFrag)
  nextTick(() => {
    vm.init()
  })
}
import mobileToast from '@/views/mobile/mobileToast.vue'
const mobileToastBox = mobileToast
mobileToast.install = function (data) {
  let instance = createApp(mobileToastBox, { data })
  const dFrag = document.createDocumentFragment()
  // 将组件挂载在文档碎片上
  const vm = instance.mount(dFrag)
  document.body.appendChild(dFrag)
  nextTick(() => {
    vm.init()
  })
}
export { mobileMessage, mobileConfirm, mobileToast }